/**
 * 安卓白金英雄坛制作组 <br>
 * 文件名：MainMenuScreen.java <br>
 * 创建时间：2013-7-9 下午7:49:41 <br>
 * 所属项目：GmudEX <br>
 * @author 12548 <br>
 */
package lostland.gmud.exv2.ui;

import lostland.gmud.exv2.MainCharTile;
import lostland.gmud.exv2.MapScreen;
import lostland.gmud.exv2.MapTile;
import lostland.gmud.exv2.ui.core.MenuScreen;

/**
 * 类名：MainMenuScreen <br>
 * 说明：主菜单界面啊啊啊a
 *
 * @author 12548
 */

public class MainMenuScreen extends MenuScreen {

	private static MainMenuScreen _instance;

	public static MainMenuScreen getInstance() {
		if (_instance == null) {
			_instance = new MainMenuScreen();
		}
		return _instance;
	}


	private MainMenuScreen() {
		super(new MainMenuButton[]{
				new MainMenuButton(0),
				new MainMenuButton(1),
				new MainMenuButton(2),
				new MainMenuButton(3),
				new MainMenuButton(4)
//				new MainMenuButton(5)
		});
		dummyBorder = new MainMenuBorder();
	}


	/* （非 Javadoc）
	 * @see lostland.gmud.exv2.ui.MenuScreen#onClick(int)
	 */
	@Override
	protected void onClick(int index) {
		switch (index) {
			case 0:
				new StatusScreen().pushToGame();
				break;
			case 1:
				new InventoryScreen(false, this).pushToGame();
				break;
			case 2:
				new SkillScreen(this).pushToGame();
				break;
			case 3:
				new ActionScreen().pushToGame();
				break;
//		case 4:
//			if(GmudUser.getCurrentUser(game) != null) {
//				GmudGame.redirectToCommunityScreen();
//			}
//			else {
//				game.pushScreen(new CommunityLoginMenu(game));
//			}
//			break;
			case 4:
				new SysMenuScreen().pushToGame();
				break;
		}
	}


	/* （非 Javadoc）
	 * @see lostland.gmud.exv2.ui.MenuScreen#onCancel()
	 */
	@Override
	public void onCancel() {
		getGame().popToRootScreen();
	}


	/* （非 Javadoc）
	 * @see lostland.gmud.exv2.ui.core.ButtonControlledScreen#show()
	 */
	@Override
	protected void show() {
		MapScreen.getInstance().getMap().draw(MapTile.getInstance(), MapScreen.X, MapScreen.Y);
		MainCharTile.getInstance().drawInMap(MainCharTile.getInstance().currentDirection, MainCharTile.getInstance().currentStep, MainCharTile.getInstance().X, MainCharTile.getInstance().Y);
		dummyBorder.draw();
		for (int i = 0; i < 5; i++) {
			buttons[i].draw();
		}
	}


}
